package it.xiuxian.xingqiu.presenter

import com.lzy.okgo.OkGo
import it.xiuxian.lib.base.BaseBean
import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.xingqiu.activity.BannerActivity
import org.json.JSONObject

class BannerActivityPresenter:BasePresenter<BannerActivity>(){
    fun submit(gongxianzhi:String,id:String){
        var json1 = JSONObject()
        json1.put("gongxianzhi",gongxianzhi)
            .put("id",id)

        OkGo.post<BaseBean<String>>(HttpConfig.BASE_URL+"/appgongyiqiang/juanxian")
            .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
            .execute(object : CallBackOption<BaseBean<String>>() {}.loadBind(mView as BannerActivity).execute(
                object : ILoadBind<BaseBean<String>> {
                    override fun excute(bean: BaseBean<String>) {
                        if(bean.code==0){
                            // ToastUtil.showShort(bean.msg)
                            (mView as BannerActivity).setdata(bean.msg)
                        }
                    }
                }
            ))
    }
}